<me:UISTOCK x:Class="WPFExcelReport.TSJDWB13"
                    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:local="clr-namespace:ReflectionStudio.Components.UserControls;assembly=ReflectionStudio.Core" 
                    xmlns:ucd="clr-namespace:ReflectionStudio.Controls;assembly=ReflectionStudio.Controls"     
                    xmlns:me="clr-namespace:WPFExcelReport" 
                     xmlns:Localization="clr-namespace:Localization;assembly=Localization"    
                    xmlns:DR="clr-namespace:WPFExcelReport;assembly=TDRAUFTR"  
              xmlns:ex="clr-namespace:WPFExcelReport.Controls;assembly=ExControls"
                    x:Name="TV"
               FTAUTOSUM="True"
                    SKEY1="TIMERANGE" 
                     KEY1="WBEWMTR"      
                    Loaded="Window_Loaded"
     >
    <me:UISTOCK.Resources>
        <CollectionViewSource  x:Key="vwMaster"/>       <CollectionViewSource  x:Key="vwDetail"/>
        <ucd:Divideby10  x:Key="d10"/>
        <ucd:BoolToVisibilityConverter  x:Key="bv"/>
        <ucd:Divideby100  x:Key="d100"/>
        <ucd:Divideby10000  x:Key="dw"/>
        <ucd:Divideby1000  x:Key="d1000"/>
        <ucd:PreisConverter  x:Key="PreisConverter"/>
        <ucd:PNumConverter  x:Key="pnum"/>
        <ucd:TextTrimmingConverter  x:Key="Trim"/>
        <ucd:NOTConverter x:Key="not"/>
        <ucd:GB2312Convert8859P1  x:Key="gb2312"/>
        <ucd:SDKEYCONV x:Key="sd"/>
    </me:UISTOCK.Resources>
    <Grid IsEnabled="{Binding IsBusy,ElementName=TV,Converter={StaticResource not}}">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"></RowDefinition>
            <RowDefinition Height="1*"></RowDefinition>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="1*"></ColumnDefinition>
        </Grid.ColumnDefinitions>
        <StackPanel Grid.Row="0">
            <WrapPanel>
                <WrapPanel>
                    <TextBlock FontSize="12" VerticalAlignment="Center" Text="{Binding Source={Localization:Translate Word=日期从:}}"></TextBlock>
                    <ex:NumericBox FontSize="12"   Text="{Binding DTSTART,ElementName=TV}" VerticalAlignment="Center" Width="80" Background="AntiqueWhite"/>
                    <TextBlock FontSize="12" VerticalAlignment="Center" Text="{Binding Source={Localization:Translate Word=时间开始:}}"></TextBlock>
                    <ex:TXT72 FontSize="12" MaxLength="4"  PRE="0000" IsAutoClear="True"  Text="{Binding VAR,ElementName=TV}" VerticalAlignment="Center" Width="80" Background="AntiqueWhite"/>
                    <TextBlock FontSize="12" VerticalAlignment="Center" Text="{Binding Source={Localization:Translate Word=日期至:}}"></TextBlock>
                    <ex:NumericBox FontSize="12"   Text="{Binding DTEND,ElementName=TV}" VerticalAlignment="Center" Width="80" Background="AntiqueWhite"/>
                    <TextBlock FontSize="12" VerticalAlignment="Center" Text="{Binding Source={Localization:Translate Word=结束:}}"></TextBlock>
                    <ex:TXT72 FontSize="12" MaxLength="4" PRE="0000" IsAutoClear="True"   Text="{Binding DESS,ElementName=TV}" VerticalAlignment="Center" Width="80" Background="AntiqueWhite"/>
                </WrapPanel>
                <TextBox    Text="{Binding LO,ElementName=TV}" MaxLength="2" Width="40" Margin="10,0,0,0"  VerticalAlignment="Center" Background="White"  CharacterCasing="Upper" TabIndex="11" />
                <TextBlock Width="Auto"  VerticalAlignment="Center">LB:</TextBlock>
                <TextBox    Text="{Binding LB,ElementName=TV}"  VerticalAlignment="Center" MaxLength="2" Width="40" Margin="10,0,0,0"  
                            HorizontalAlignment="Left" Background="White"  CharacterCasing="Upper" TabIndex="11" />
                <Button FontSize="18" Content="{Binding Source={Localization:Translate Word=更新}}"  Margin="10,0,0,0"   Click="NewCommand"></Button>
                <Button FontSize="18" Content="{Binding Source={Localization:Translate Word=查询}}"  Margin="10,0,0,0"     Click="QueryCommand" ></Button>
                <DR:TDRAUFTR  Grid.Column="0" Name="cDR" DocType="SJDWB13" PrintType="OpenExcel" />
                <Button FontSize="18" Content="{Binding Source={Localization:Translate Word=打印}}" Margin="20,0,0,0"   Width="Auto"  
                        Click="PrintCommand"/>
            </WrapPanel>
        </StackPanel>
        <Grid Grid.Row="1">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"></RowDefinition>
                <RowDefinition Height="1*"></RowDefinition>
                <RowDefinition Height="Auto"></RowDefinition>
            </Grid.RowDefinitions>
            <StackPanel Grid.Row="0">
                <WrapPanel>
                    <TextBlock Width="Auto" VerticalAlignment="Center">LO:</TextBlock>
                    <TextBlock Width="Auto"  VerticalAlignment="Center">批号:</TextBlock>
                    <TextBox   Text="{Binding PARTIE,ElementName=TV}" VerticalAlignment="Center"  Width="100" Margin="10,0,0,0" 
                               HorizontalAlignment="Left" Background="White"  CharacterCasing="Upper" TabIndex="11" />
                    <TextBlock Width="Auto"  VerticalAlignment="Center">面料:</TextBlock>
                    <TextBox   VerticalAlignment="Center" 
                               Text="{Binding ART,ElementName=TV}"
                               Width="100" Margin="10,0,0,0"   HorizontalAlignment="Left" Background="White"  CharacterCasing="Upper" TabIndex="11" />
                     <Button Width="Auto" Content="{Binding Source={Localization:Translate Word=过滤}}" Margin="10,0,0,0"  HorizontalAlignment="Left"  Click="FilterMaster_Click"></Button>
                    <Button Width="Auto" Content="{Binding Source={Localization:Translate Word=清除}}" Margin="10,0,0,0" HorizontalAlignment="Left"  Click="FilterMasterClear_Click"></Button>
                </WrapPanel>
            </StackPanel>
            <DataGrid CanUserReorderColumns="True"   
                  Grid.Row="1"
                  Grid.Column="0"
                          FontSize="12"
                          CanUserResizeRows="True" 
                          CanUserSortColumns="True"                  
                          AutoGenerateColumns="False"   
                          EnableRowVirtualization="True"  
                          RowDetailsVisibilityMode="VisibleWhenSelected" 
                          HorizontalAlignment="Stretch" 
                          VerticalAlignment="Top"
                            Name="dlgMaster"
                          IsSynchronizedWithCurrentItem="True"
                          ItemsSource="{Binding Source={StaticResource ResourceKey=vwMaster}}" 
                          Margin="0,1,0,0" >
                <DataGrid.Columns>

                    <DataGridTextColumn Binding="{Binding Path=WAART,Converter={StaticResource ResourceKey=gb2312}}" Header="品种"  Width="80" />
                    <DataGridTextColumn Binding="{Binding Path=WABEZ,Converter={StaticResource ResourceKey=gb2312}}" Header="品名"  Width="100" />
                    <DataGridTextColumn Binding="{Binding Path=WBEWSTKNR}" Header="卷号"  Width="Auto" />
                    <DataGridTextColumn Binding="{Binding Path=DCG,Converter={StaticResource ResourceKey=gb2312}}" Header="挡车工"  Width="60" />
                    <DataGridTextColumn Binding="{Binding Path=DCGQTY,Converter={StaticResource ResourceKey=d1000}}" Header="产量"  Width="60" />
                    
                    <DataGridTextColumn Binding="{Binding Path=WBEWZENSURKZ}" Header="等级"  Width="Auto" />
                    <DataGridTextColumn Binding="{Binding Path=WBFMARKART,Converter={StaticResource sd},ConverterParameter=9318}" Header="织造班"  Width="Auto" />
                    <DataGridTextColumn Binding="{Binding Path=WBBREFSCHL,Converter={StaticResource sd},ConverterParameter=9318}" Header="验布班"  Width="Auto" />
                    <DataGridTextColumn Binding="{Binding Path=PCS}" Header="卷数"  Width="Auto" />
                    <DataGridTextColumn Binding="{Binding Path=WBBSSTKLG,Converter={StaticResource d1000}}" Header="米数"  Width="Auto" />
                    <DataGridTextColumn Binding="{Binding Path=WBBZMT}" Header="卷次"  Width="Auto" />
                    <DataGridTextColumn Binding="{Binding Path=ABPARTEX,Converter={StaticResource ResourceKey=gb2312}}" Header="批号"  Width="60" />
                    <DataGridTextColumn Binding="{Binding Path=WBBSBRT,Converter={StaticResource d100}}" Header="门幅"  Width="Auto" />
                    <DataGridTextColumn Binding="{Binding Path=WBBHHK1,Converter={StaticResource d1000}}" Header="纬密"  Width="Auto" />
                    <DataGridTextColumn Binding="{Binding Path=WBBNEUBEN}" Header="验布工号"  Width="60" />
                    <DataGridTextColumn Binding="{Binding Path=WBBWMLFDNR}" Header="机台号"  Width="60" />  
                    <DataGridTextColumn Binding="{Binding Path=WBEWBUCHDAT}" Header="生产日期"  Width="Auto" />
                    <DataGridTextColumn Binding="{Binding Path=REMARK,Converter={StaticResource gb2312}}" Header="疵点"  Width="Auto" />
                </DataGrid.Columns>
            </DataGrid  >
            <WrapPanel Grid.Row="2" Grid.Column="1">
                <WrapPanel >
                    <TextBlock Text="{Binding TKEY1}"  Margin="10,0,0,0"></TextBlock>
                    <TextBlock Text="{Binding SUM1,Converter={StaticResource d100}}" Foreground="Red" Margin="10,0,0,0"></TextBlock>
                    <TextBlock Text="{Binding TKEY2}"   Margin="10,0,0,0"></TextBlock>
                    <TextBlock Text="{Binding SUM2}" Foreground="Red" Margin="10,0,0,0"></TextBlock>
                    <TextBlock Text="{Binding Counts}" Foreground="Red" Margin="20,0,0,0"></TextBlock>
                </WrapPanel>
            </WrapPanel>
        </Grid>
    </Grid>
</me:UISTOCK>
